package gimys;

import java.util.LinkedList;

public class Path {
		
	LinkedList<Point> path;
	int pathIndex;
	
	public Path(Point p) {
		path = new LinkedList<Point>();
		path.add(p);
		pathIndex = 0;
	}
	
	public Path(Path pathToCopy) {
		path = new LinkedList<Point>();
		for (Point p : pathToCopy.path) {
			this.addPoint(p);
		}
		pathIndex = 0;
	}
	
	public void addPoint(Point p) {
		path.add(p);
	}
	
	public void nextPoint() {
		if (pathIndex >= path.size()-1) {
			pathIndex = 0;
		}
		else {
			pathIndex++;
		}
	}
	
	public Point getPoint() {
		//System.out.println("getpoint  " + new Point(path.get(pathIndex).x, path.get(pathIndex).y));
		return new Point(path.get(pathIndex).x, path.get(pathIndex).y);
	}
	
	public void translate(float dx, float dy) {
		for (Point p : path) {
			p.x += dx;
			p.y += dy;
		}
	}
}
